package com.itheima.demo.demo03.demo04;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class JiShu {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入字符串");
        String s = sc.next();
        Map<Character,Integer>map=new HashMap<>();
        for (char c : s.toCharArray()) {
            if(map.containsKey(c)){
            Integer value = map.get(c);
            value++;
            map.put(c,value);
            }else {
                map.put(c,1);
            }
        }

        for (Character key : map.keySet()) {
            Integer value = map.get(key);
            System.out.println(key+" "+value);


        }




        }

    }

